Repository navigation
feat(examples): add examples:check command for typechecking JSDoc snippets - #38
Merged
Merged
Conversation
…nippets Adds `zile examples:check [--fix]` which extracts every fenced `ts` / `ts twoslash` / `typescript` block from JSDoc comments under `src/`, runs `tsc --noEmit` against them, and (optionally) runs each snippet through `oxfmt`. Snippets containing `// @noErrors` or `// @errors: <codes>` (twoslash conventions) are skipped from typechecking. Lines annotated with `// [!code --]` are stripped from the snippet before checking so old diff lines don't break the build. Also adds an opt-in `--check-examples` flag to `zile build`. Amp-Thread-ID: https://ampcode.com/threads/T-019e488f-68ce-7377-8ce7-b3848e22594b
commit: |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
zile examples:check [--fix]which extracts every fencedts/ts twoslash/typescriptblock from JSDoc comments undersrc/, runstsc --noEmitagainst them, and (optionally) runs each snippet throughoxfmt.Twoslash directive support
// @noErrorsor// @errors: <codes>(twoslash conventions) are skipped from typechecking — they're intentionally meant to error.// [!code --]are stripped from the snippet before checking, so old diff lines don't break the build.zile buildintegrationAdds an opt-in
--check-examplesflag tozile buildto runexamples:checkbefore building.Testing
bun test— 7 tests pass (4 existing + 3 new for the directive support).